package org.webscale.util.sqs;
import org.apache.log4j.Logger;
import org.webscale.ApplicationController;

import com.xerox.amazonws.sqs2.Message;
import com.xerox.amazonws.sqs2.MessageQueue;

public class MessageHandlerRunner  implements Runnable{
	static final String SQS_MESSAGE_HANDLER ="sqsMessageHandler";
	Message message;
	MessageQueue queue;
	SQSMessageHandler handler;
	public MessageHandlerRunner(Message msg , MessageQueue q) {
		this.message = msg;
		this.queue = q;
		handler =(SQSMessageHandler)ApplicationController.instance().locateObject(SQS_MESSAGE_HANDLER);
	}
	

	public void run() {
		handler.onMessage(message , queue);
	}
}
